package com.example.administrator.szb.fragments.fragment_forTab.home.model;

import android.app.Activity;

import com.example.administrator.szb.http.OnResultListener;

/**
 * Created by stone on 2018/1/19.
 */

public interface HomeModel {

    void getData(Activity activity, OnResultListener listener);
    /*Map<String, String> map = new HashMap<String, String>();

        map.put("code", HttpUtil.getParam());
        String json = GetJsonDataUtil.simpleMapToJsonStr(map);
        String url = URLAddress.URLBASE + URLAddress.URL_INDEX;
        HttpUtil.RequestGsonPost(SampleApplicationLike.getQueueInstance(), Request.Method.POST, IndexBean.class, URLAddress.URLBASE + URLAddress.URL_INDEX, map, new Response.Listener() {
            @Override
            public void onResponse(Object response) {
                indexBean = (IndexBean) response;

                if (indexBean.getResult() == 1) {
                    SharedPreferencesUtil.savaData(getActivity(),indexBean,key);
                    SampleApplicationLike.setIndexBeanInstance(indexBean);
                    mdata_refresh.clear();
                    mdata_refresh.addAll(indexBean.getData().getHotCoun());
                    homeFragmentSwiperefreshlayout.setRefreshing(false);
                    try{
                        adapter.notifyDataSetChanged();
                    }catch (Exception e){
                        e.toString();
                    }


                    try {
                        titles = new String[indexBean.getData().getBusiness().size()];
                        for (int i = 0; i < indexBean.getData().getBusiness().size(); i++) {
                            titles[i] = indexBean.getData().getBusiness().get(i).getTitle();
                        }
                        homeFragmentLlError.setVisibility(View.INVISIBLE);
                        pullLoadMoreRecyclerView.setVisibility(View.VISIBLE);
                        homeFragmentFramelayout.setVisibility(View.VISIBLE);
                        imageView27.setVisibility(View.VISIBLE);
                        SampleApplicationLike.setIndexBeanInstance(indexBean);
                        initViewPage();//广告轮播图
                        initGridViewPager();//标签分类viewpage
                        initRecyclerview();//列表
                        initButton();//初始化homefragment页面上的跳转按钮
                    } catch (Exception e) {

                    }

                } else {

                }

            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                //String err = error.toString();

                indexBean = (IndexBean) SharedPreferencesUtil.getData(getActivity(),key);
                if (indexBean != null){
                    titles = new String[indexBean.getData().getBusiness().size()];
                    for (int i = 0; i < indexBean.getData().getBusiness().size(); i++) {
                        titles[i] = indexBean.getData().getBusiness().get(i).getTitle();
                    }
                    initViewPage();//广告轮播图
                    initGridViewPager();//标签分类viewpage
                    initRecyclerview();//列表
                    homeFragmentSwiperefreshlayout.setRefreshing(false);
                    Toasts.show(mActivity, "网络异常", Toast.LENGTH_SHORT);
                }else {
                    homeFragmentLlError.setVisibility(View.VISIBLE);
                    homeFragmentFramelayout.setVisibility(View.GONE);
                    imageView27.setVisibility(View.GONE);
                    homeFragmentSwiperefreshlayout.setRefreshing(false);
                }

                //Toasts.show(mActivity, "检查网络", Toast.LENGTH_SHORT);
            }
        });*/
}
